package cn.dinghu.pro.utils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class OrderUtil {
    private static final String PREFIX = "GOD"; // 订单业务标识
    private static int seq = 0;

    public static synchronized String gen() {
        String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
        return PREFIX + time + String.format("%04d", seq++ % 10000);
    }

    public static void main(String[] args) {
        System.out.println(OrderUtil.gen());
    }
}
